WiringPi Bindings for Rust
An API wrapper for WiringPi to make it accessible using Rust. It implements the most important functions and provides a bit of type system convenience.
Add the following lines to your Cargo.io
to use rust-wiringpi
:
[]
= "0.2"
Online Documentation
Example: Flashing Light
extern crate wiringpi;
use ;
use ;
Cross Compiling Using Cargo
Follow this guide.
cargo build --target=arm-unknown-linux-gnueabihf # Older models
cargo build --target=armv7-unknown-linux-gnueabihf # Newer models
Orange Pi support
rust-wiringpi
can also wrap the WiringOP library for the Orange Pi SBC boards.
This can be enabled with the orangepi
feature:
[]
= "0.2"
= ["orangepi"]
Development Mode
In development mode, rust-wiringpi
is compiled as a rust-native library excluding the original WiringPi.
And binding functions are replaced by dummy functions that output simple logs to stdout.
With this mode, you can build and debug your project on platforms that does not support WiringPi.
# build
$ cargo build --features wiringpi/development
# run
$ cargo run --features wiringpi/development
[wiringpi] `wiringPiSetup` called
[wiringpi] `pinMode` called with: 0, 1
[wiringpi] `digitalWrite` called with: 0, 1
[wiringpi] `digitalWrite` called with: 0, 0
...